import request from './request'

// 用户登录接口
export const loginApi = (loginData) => {
  return request.post('/user/login', loginData)
}

// 获取当前用户信息
export const getCurrentUserInfo = () => {
  return request.get('/user/currentUserInfo')
}

// 修改密码
export const changePassword = (data) => {
  return request.post('/user/changePassword', data)
}

// 用户分页查询
export const getUserPage = (params) => {
  return request.get('/user/page', { params })
}

// 用户详情查询
export const getUserDetail = (id) => {
  return request.get(`/user/${id}`)
}

// 用户新增
export const createUser = (userData) => {
  return request.post('/user', userData)
}

// 用户更新
export const updateUser = (userData) => {
  return request.put('/user', userData)
}

// 导出上传函数，方便其他地方使用
export { uploadFile as uploadAvatar } from '../utils/upload'
